# Makefile for altbit
#
# NOTE: Because dynamic DOORS libraries are used, the library path must
#       exist in LD_LIBRARY_PATH which can be used in adding extra library
#       directories. For example:
#
#       tcsh: setenv LD_LIBRARY_PATH /share/faster/doors/install/lib
#       bash: export LD_LIBRARY_PATH=/share/faster/doors/install/lib
#       zsh: Who cares?
 
DOORS = /share/faster/doors
CXX = g++
DOORS_INCLUDES = -I/share/faster/doors/include
DOORS_LIBS = -L/share/faster/doors/lib -ldoors_tools -ldoors_protocols -ldoors_base
CXXFLAGS = -g $(DOORS_INCLUDES)
COAPOBJS = coap.o coaptask.o coapsm.o coappdu.o coapsap.o

all: coap

coap: $(COAPOBJS)
	$(CXX) $(CXXFLAGS) -o coap $(COAPOBJS) $(DOORS_LIBS)

coappdu.cpp: coappdu.h

coap.cpp: coaptask.h

coaptask.cpp: coaptask.h

coaptask.h: coapsm.h coappdu.h coapsap.h

coapsap.cpp: coapsap.h

coapsap.h: coap.sap
	$(DOORS)/bin/dsapg --hh-file coapsap.h --cc-file coapsap.cpp coap.sap

coappdu.h: coap.pdu
	$(DOORS)/bin/dpeerg --hh-file coappdu.h --i-file coappdu.i coap.pdu

coapsm.cpp: coapsm.h

coapsm.h: coap.sm
	$(DOORS)/bin/dsmg --hh-file coapsm.h --cc-file coapsm.cpp coap.sm

clean:
	rm -rf coap *.o coapsm.h coapsm.cpp coappdu.h coappdu.i coapsap.h coapsap.cpp *~

